using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using LGE;

namespace TileMapEditor
{
    public class TileMapEditor : Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        public static SpriteFont Font;

        public TileMapEditor()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            Mouse.WindowHandle = Window.Handle;
            IsMouseVisible = true;
        }
        
        protected override void Initialize()
        {
            Engine.InitGraphicsMode(graphics, 1280, 720, false);
            base.Initialize();
        }

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Engine.Init(this, new StartScreen());
            Engine.InitTileSystem(50, 50, 30, "Tiles");
            Font = Engine.Load<SpriteFont>("font");
        }

        protected override void Update(GameTime gameTime)
        {
            GameScreenManager.Update(gameTime);
            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            spriteBatch.Begin();
            GameScreenManager.Draw(gameTime, spriteBatch);
            spriteBatch.End();
            base.Draw(gameTime);
        }
    }

#if WINDOWS || XBOX
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            using (TileMapEditor game = new TileMapEditor())
            {
                game.Run();
            }
        }
    }
#endif
}
